package com.aaa.controller;

import com.aaa.dao.FuserMapper;
import com.aaa.service.FuserService;
import com.wsc.entity.FUser;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("fuser")
public class FuserController {
    @Resource
    FuserService f_userService;
    @Resource
    FuserMapper fuserMapper;
    @RequestMapping("login")
    public Object select(FUser fUser){
        if(f_userService.selectByNP(fUser).size()>0){
        return "登陆成功";
        }else{
            return "登陆失败";
        }
    }
    @RequestMapping("updateP")
    public Object updateP(FUser fUser){
        return f_userService.updateP(fUser);
    }
    @RequestMapping("updateSelf")
    public Object updateSelf(FUser fUser){
       return f_userService.updateSelf(fUser);
    }
    @RequestMapping("updatePhone")
    public Object updatePhone(FUser fUser){
        return f_userService.updatePhone(fUser);
    }

    @RequestMapping("select")
    @ResponseBody
    public Object select2(){
        return fuserMapper.selectList(null);
    }
    @RequestMapping("selects")
    @ResponseBody
    public Object select(Integer pageCode, Integer pageSize, FUser fuser){
        return f_userService.select(pageCode, pageSize, fuser);
    }
    @RequestMapping("updateS")
    @ResponseBody
    public Integer updateS(FUser f_user) {
        return f_userService.updateS(f_user);
    }
    @RequestMapping("insert")
    public Integer insert(FUser fUser){
        return fuserMapper.insert(fUser);
    }
    @RequestMapping("delete")
    public Integer delete(Integer id){
        return fuserMapper.deleteById(id);
    }
}
